If the first operand is of type uint or ulong, the right-shift is a logical shift.
2.
Logical shifts can be useful as efficient ways to perform multiplication or division of unsigned integers by powers of two.
3.
In computer science, a "'logical shift "'is a bitwise operation that shifts all the bits of its operand.
4.
When performed on an unsigned type, the operation performed is a logical shift, causing the blanks to be filled by 0s ( zeros ).
5.
Unlike a logical shift, the vacant bit positions are not filled in with zeros but are filled in with the bits that are shifted out of the sequence.
6.
Then, treating the bits representing the floating-point number as a 32-bit integer, a logical shift right by one bit is performed and the result subtracted from the 0x5f3759df.
7.
Most C and C + + implementations, and Go, choose which right shift to perform depending on the type of integer being shifted : signed integers are shifted using the arithmetic shift, and unsigned integers are shifted using the logical shift.
8.
The naturalistic conception of humans, which has so far been unable to make the strictly logical shift from animals to humans themselves, and which sometimes argues that the problem lies in the absence of a missing link that is yet to be found, is mistaken.
9.
Unlike an arithmetic shift, a logical shift does not preserve a number's sign bit or distinguish a number's exponent from its significand ( mantissa ); every bit in the operand is simply moved a given number of bit positions, and the vacant bit-positions are filled, usually with zeros ( contrast with a circular shift ).
10.
For example, if the carry flag contains 0, then x RIGHT-ROTATE-THROUGH-CARRY-BY-ONE is a logical right-shift, and if the carry flag contains a copy of the sign bit, then x RIGHT-ROTATE-THROUGH-CARRY-BY-ONE is an arithmetic right-shift . For this reason, some microcontrollers such as low end PICs just have " rotate " and " rotate through carry ", and don't bother with arithmetic or logical shift instructions.